package com.event.management.backend.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 票种信息数据传输对象
 */
@Data
@ApiModel(value = "票种信息", description = "票种详细信息")
public class TicketDTO {
    
    @ApiModelProperty(value = "票种ID")
    private Long id;
    
    @ApiModelProperty(value = "关联活动ID", required = true)
    @NotNull(message = "关联活动ID不能为空")
    private Long eventId;
    
    @ApiModelProperty(value = "票种名称", required = true)
    @NotBlank(message = "票种名称不能为空")
    @Size(min = 2, max = 50, message = "票种名称长度必须在2-50个字符之间")
    private String name;
    
    @ApiModelProperty(value = "票种说明")
    private String description;
    
    @ApiModelProperty(value = "票价", required = true, example = "99.00")
    @NotNull(message = "票价不能为空")
    @DecimalMin(value = "0.00", message = "票价必须大于等于0")
    private BigDecimal price;
    
    @ApiModelProperty(value = "总库存", required = true, example = "100")
    @NotNull(message = "总库存不能为空")
    @Min(value = 0, message = "总库存必须大于等于0")
    private Integer totalStock;
    
    @ApiModelProperty(value = "已售数量", example = "0")
    private Integer soldCount;
    
    @ApiModelProperty(value = "每个用户限购数量", example = "2")
    @Min(value = 1, message = "每人限购数量必须大于等于1")
    private Integer limitPerUser;
    
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdAt;
    
    @ApiModelProperty(value = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedAt;
} 